﻿using EM.OA.BLL;
using EM.OA.DataModel.DBModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EM.OA.WebCommon
{
    public class SystemLog
    {
        /// <summary>
        /// 写系统日志
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="userIP">用户IP</param>
        /// <param name="logKind">日志类型</param>
        /// <param name="logDesc">日志描述</param>
        /// <param name="logUrl">当前URL</param>
        /// <param name="functionID">当前功能ID</param>
        public static void WriteLog(Guid? userID, string userIP, Guid? logKind, string logDesc, string logUrl, Guid? functionID)
        {
            try
            {
                EMOA_SystemLog log = new EMOA_SystemLog
                {
                    LogID = Guid.NewGuid(),
                    UserID = userID,
                    UserIP = userIP,
                    LogKind = logKind,
                    LogDescription = logDesc,
                    LogUrl = logUrl,
                    LogTime = DateTime.Now,
                    FunctionID = functionID
                };
                SystemLogBLL logBll = new SystemLogBLL();
                logBll.Add(log);
            }
            catch
            {

            }
        }
    }
}
